package com.swipemaster.record;

import com.swipemaster.common.Const;
import com.swipemaster.network.WorldRecord;

public class SurvivalRecord extends Record
{
	public double time;
	private static final long serialVersionUID = 1L;

	public SurvivalRecord(int id)
	{
		super(id);
	}

	@Override
	public Record clone(WorldRecord worldRecord)
	{
		final SurvivalRecord clone = new SurvivalRecord(recordId.getId());
		clone.time = worldRecord.time;
		return clone;
	}

	@Override
	public String getRecordStringForPHP()
	{
		return time + "";
	}

	@Override
	public boolean isBetter(Record score)
	{
		final SurvivalRecord other = (SurvivalRecord) score;
		return time > other.time;
	}

	@Override
	public boolean isValid()
	{
		return time > 0;
	}

	@Override
	public String toString()
	{
		return Const.decimalFormat.format(time) + "s";
	}
}
